<table class="table table-bordered table-hover table-striped">
	<tbody>
		<tr align="center">
			<td width="5%"><strong>编号</strong></td>
			<td width="5%"><strong>房间号</strong></td>
			<td width="5%"><strong>类型</strong></td>
			<td width="10%"><strong>设备ID</strong></td>
			<td width="7%"><strong>原始起数</strong></td>
			<td width="5%"><strong>费率</strong></td>
			<td width="10%"><strong>最后抄表数</strong></td>
			<td width="10%"><strong>抄表时间</strong></td>
			<td width="10%"><strong>状态</strong></td>
			<td width="10%"><strong>建档时间</strong></td>
			<td width="10%"><strong>建档人</strong></td>
			<td width="10%"><strong>操作</strong></td>
		</tr>
		<?php if(is_array($list) && count($list)){ foreach($list as $k=>$ls){ ?>
			<?php $rowspan = count($ls['list']); foreach($ls['list'] as $kk=>$lls){ ?>
				<tr align="center">
				<?php if($kk==0){ ?>
					<td rowspan="{$rowspan}" style="background-color: #ffffff"><?php echo ($page-1)*C('PAGE_SIZE')+($k+1); ?></td>
					<td rowspan="{$rowspan}" style="background-color: #ffffff">{$ls['roomnumber']}</td>
				<?php } ?>
					<td>{$lls['eqmtitle']}</td>
					<td>{$lls['eqmnumber']}</td>
					<td>{$lls['start_number']}</td>
					<td>{$lls['rates']}</td>
					<td>{$lls['last_number']/10}</td>
					<td><?php echo date('Y-m-d H:i', $lls['updatetime']); ?></td>
					<td id="st_{$lls['id']}"><?php echo $lls['status'] ? '启用' : '停用'; ?></td>
					<td><?php echo date('Y-m-d H:i', $lls['createtime']); ?></td>
					<td>{$lls['user_nick']}</td>
					<td>
						<a href="javascript:void(0);" class="act" vl="1" ids="{$lls['id']}">启用</a> | 
						<a href="javascript:void(0);" class="act" vl="0" ids="{$lls['id']}">停用</a> |
						<a href="javascript:void(0);" class="edit" ids="{$lls['id']}">编辑</a>
					</td>
				</td>
			<?php } ?>
		<?php }}else{ ?>
		<tr align="center">
			<td colspan="14">暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<div class="pagination" style="float: right; widht: 95%">
	<include file="Common/page" />
</div>
<script>
	$(document).ready(function(){
		$("a.delete").on('click', function(){
			if (confirm("确认删除？") == true){
				var obj = $(this);
				var room_id = obj.attr('room_id');
				layer.load(2);
				$.post("remove.html",{id: room_id}, function(data){
					if(data/1){
						layer.msg('删除成功');
						obj.parent('td').parent('tr').remove();
					}else{
						layer.msg('删除失败');
					}
				});
			}
		});
		//修改状态
		$(".act").on('click', function(){
			var obj = $(this);
			var	status = obj.attr('vl');
			var	id = obj.attr('ids');
			$.post('eqment/setstatus.html', {id: id, status: status}, function(data){
				if(data/1){
					var shtml = status/1 == 1 ? '启用' : '停用';
					$("#st_"+ id).html(shtml);
				}
			});
		});
		
		$(".edit").on('click', function(){
			var obj = $(this);
			var	id = obj.attr('ids');
			var load = layer.load(2);
			$.get('eqment/info.html', {id: id}, function(data){
				if(data.errCode/1){
					layer.close(load);
					var info = data.info;
					$("#eid").val(info.id);
					$("#room_number").val(info.roomnumber);
					$("#typeid").val(info.typeid);
					$("#eqmnumber").val(info.eqmnumber);
					$("#start_number").val(info.start_number);
					$("#rates").val(info.rates);
					$("#eqmid").val(info.eqmid);
					$("#comd").val(info.comd);
					$("#comd2").val(info.comd2);
					$("#comd3").val(info.comd3);
				}else{
					layer.msg('获取数据失败');
				}
			});
		});
	});
</script>